import {createRouter,createWebHistory,RouteRecordRaw} from 'vue-router'
const routes:Array<RouteRecordRaw> = [
    {
        path:'',
        redirect:(_)=>{
            return {path:'/home'}
        }
    },
    {
        "path":'/home',
        "name":'Helloworld',
        "component": import('./components/HelloWorld.vue')
    },
    {
        path: '/about',
        name: 'About',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () =>
            import('./components/About.vue'),
    },
]

const router = createRouter({
    history:createWebHistory(''),
    routes,
    scrollBehavior(to,from,savedPosition){
        return {el:"app",top:0,behavior:'smooth'}
    }
})
export default router